package com.weixing.mall.provider.controller.rpc;

import com.weixing.mall.base.wrapper.Result;
import com.weixing.mall.base.wrapper.ResultUtil;
import com.weixing.mall.core.support.BaseController;
import com.weixing.mall.provider.api.model.vo.SysConfigVo;
import com.weixing.mall.provider.api.model.vo.SysUserEditVo;
import com.weixing.mall.provider.service.IConfigService;
import com.weixing.mall.provider.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: kfc
 * @Description: <br/>
 * Date:Create in 2019/9/17 15:41
 * @Modified By:
 */
@RestController
@RequestMapping("/api/cfg")
public class SysConfigRpcController extends BaseController {
    @Autowired
    private IConfigService sysConfigService;
    @Autowired
    private IUserService sysUserService;

    @GetMapping("getByCode")
    public Result<SysConfigVo> getByCfgCode(String cfgCode){
        SysConfigVo sysConfig = sysConfigService.selectVoByCfgCode(cfgCode);
        return ResultUtil.success(sysConfig);
    }

    @GetMapping("getUserById")
    public Result<SysUserEditVo> getUserById(Long userId){
        SysUserEditVo sysUserEditVo = sysUserService.selectSysUserEditVoById(userId);
        return ResultUtil.success(sysUserEditVo);
    }
}
